import React from 'react';
import FileUpload from './FileUpload';

class FileUploader extends React.Component {
    render(){
        /*指定参数*/
        var options={
            baseUrl:'/manage/product/upload.do',
            fileFieldName:'upload_file',
            chooseAndUpload:true,
            uploadSuccess:this.props.onSuccess,
            uploadError:this.props.onError
        }
        /*调用FileUpload,传入options。然后在children中*/
        /*传入两个dom(不一定是button)并设置其ref值。*/
        return (
            <FileUpload options={options}>
                <button className="btn btn-info btn-xs" ref="chooseAndUpload">选择图片</button>
                {/* <button ref="uploadBtn">upload</button> */}
            </FileUpload>
        )	        
    }
}
export default FileUploader;